
let { postDataJson,getData,uploadImg,getBuffer } = require("./request"); //封装request 引入
const api = {
    login: (data) => {//每次进来登录
        return postDataJson(`/supermarket/mobile/xcxLogin?code=${data}`)
    },
    xcxFirstLogin: (data) => {//授权手机号
        return postDataJson(`/supermarket/mobile/xcxFirstLogin?phoneCode=${data.phoneCode}&loginCode=${data.loginCode}`)
    },
    getInfo:(data) => {
        return getData(`/getInfo`)
    },
    //全部车-分页
    information:(data)=>{
        return getData(`/supermarket/mobile/information/list`,data)
    },
    informationId:(inforId)=>{
        return getData(`/supermarket/mobile/information/${inforId}`)
    },
    // 添加-编辑银行卡
    addBank:(data)=>{
        return postDataJson(`/supermarket/mobile/bankCard`,data)
    },
    // 银行卡列表
    bankCardList:(data)=>{
        return getData(`/supermarket/mobile/bankCard/myList`,data)
    },
    // 商品列表
    goodsList:(data)=>{
        return getData(`/supermarket/mobile/goods/list`,data)
    },
      // 商品详情
      goodsDetail:(data)=>{
        return getData(`/supermarket/mobile/goods/${data}`)
    },
        // 提现分页列表
    myWithdrawalList:(data)=>{
        return getData(`/supermarket/mobile/record/myWithdrawalList`)
    },
        // 提现
    withdrawal:(data)=>{
        return postDataJson(`/supermarket/mobile/record/withdrawal?amountMoney=${data.amountMoney}&type=${data.type}`,data)
    },
        // 上传头像
    uploadImg:(data)=>{
        return uploadImg(`/supermarket/mobile/oss/upload`,data)
    },
    // 修改用户信息
    edit:(data)=>{
        return postDataJson(`/supermarket/mobile/user/edit`,data)
    },
    region:(data)=>{
        return uploadImg(`/supermarket/mobile/region`,data)
    },
        // 粉丝列表
    myFans:(data)=>{
        return getData(`/supermarket/mobile/user/myFans`,data)
    },
        // 获取邀请码
    getMyInvitationCode:(data)=>{
        return getBuffer(`/supermarket/mobile/user/getMyInvitationCode`)
    },
        //  // 获取邀请码-二维码
        //  getMyInvitationCode:(data)=>{
        //     return postDataJson(`/supermarket/mobile/region/getMyInvitationCode`)
        // },
    // 删除银行卡
    delBankCardId:(bankCardId)=>{
        return getData(`/supermarket/mobile/bankCard/delete/${bankCardId}`)
    },
    // 订单列表
    orderList:(data)=>{
        return getData(`/supermarket/mobile/order/myList`,data)
    },
     // 修改订单
     changeOrder:(data)=>{
        return getData(`/supermarket/mobile/order/complete`,data)
    },
       // 商品类型  platform_phone  home_page_banner  goods_type   withdrawal_rate
    dictType:(type)=>{
        return getData(`/system/dict/data/type/${type}`)
    },
    getMyInvitationCodeAndAccessToken:()=>{
        return getData(`/supermarket/mobile/user/getMyInvitationCodeAndAccessToken`)
    },
    //邀请码登录
    yqmLogin:(data)=>{
        return postDataJson(`/supermarket/mobile/yqmLogin?code=${data.code}&invitationCode=${data.invitationCode}`)
    },
    yqmFirstLogin:(data)=>{
        return postDataJson(`/supermarket/mobile/yqmFirstLogin?phoneCode=${data.phoneCode}&loginCode=${data.loginCode}&invitationCode=${data.invitationCode}`)
    },
    orderAdd:(data)=>{
        return postDataJson(`/supermarket/mobile/order/add?businessId=${data}`)
    },
};
module.exports = api;

// const API = {
//     // =====通用api，上传图片等
//     'commonApi': {
//         'uploadImg': 'uploadServer/upload/uploadImg', //上传图片
//     },
//     'login': {
//         'login': '/supermarket/mobile/xcxLogin',//登录
//         'getPhoneNumber': 'webServer/miniApp/getPhoneNumber',//获取手机号
//         'getCode': 'webServer/miniApp/code2session'//获取code
//     },
// }
// module.exports = {
//     api: API
// }
    // module.exports.API = API